<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <div id="app">
        <!--{{smovies}} 找movies变量 在父组件中查找 -->
        <cpn v-bind:smovies="movies" :smessage="message"></cpn>
    </div>
    <template id="cpn">
        <div>
           <ul>
                <li v-for="item in smovies">
                        {{item}}
                </li>
           </ul>
            <p>{{smessage}}</p>
        </div>
    </template>
    <script src="../js/vue.js"></script>
       
    <script>
        //父传子 通过props
        const cpn={
            template:'#cpn',
            //props:['smovies','smessage']
            props:{
                smovies: {
                    type: Array,
                    default(){
                        return []
                    }
                },
                  //提供一些默认值
                smessage: {
                    type:String,
                    default:'AAA',
                    required: true //必传
                }
              

            }
        }
          //root 组件
          const app=new Vue({
            el:'#app',
            data:{
                message: "你好",
                movies:['A','B','C']
            },
            components:{
                cpn
            }
        })
    </script>
</body>
</html>